/**
 *
 */
import Util;
import OpenApi;
import OpenApiUtil;
import EndpointUtil;

extends OpenApi;


init(config: OpenApi.Config){
  super(config);
  @endpointRule = '';
  
  checkConfig(config);
  @endpoint = getEndpoint('dm', @regionId, @endpointRule, @network, @suffix, @endpointMap, @endpoint);
}

function getEndpoint(productId: string, regionId: string, endpointRule: string, network: string, suffix: string, endpointMap: map[string]string, endpoint: string) throws: string{
  if (!Util.empty(endpoint)) {
    return endpoint;
  }
  
  if (!Util.isUnset(endpointMap) && !Util.empty(endpointMap[regionId])) {
    return endpointMap[regionId];
  }
  return EndpointUtil.getEndpointRules(productId, regionId, endpointRule, network, suffix);
}

model AddIpfilterRequest {
  ipAddress?: string(name='IpAddress', description='This parameter is required.'),
  ownerId?: long(name='OwnerId'),
  resourceOwnerAccount?: string(name='ResourceOwnerAccount'),
  resourceOwnerId?: long(name='ResourceOwnerId'),
}

model AddIpfilterResponseBody = {
  ipFilterId?: string(name='IpFilterId', example='10795'),
  requestId?: string(name='RequestId', example='F814E960-5AEE-5CB1-881B-6F1A3250B55A'),
}

model AddIpfilterResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: AddIpfilterResponseBody(name='body'),
}

/**
 * @summary 添加IP白名单
 *
 * @param request AddIpfilterRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return AddIpfilterResponse
 */
async function addIpfilterWithOptions(request: AddIpfilterRequest, runtime: Util.RuntimeOptions): AddIpfilterResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.ipAddress)) {
    query['IpAddress'] = request.ipAddress;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!Util.isUnset(request.resourceOwnerAccount)) {
    query['ResourceOwnerAccount'] = request.resourceOwnerAccount;
  }
  if (!Util.isUnset(request.resourceOwnerId)) {
    query['ResourceOwnerId'] = request.resourceOwnerId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'AddIpfilter',
    version = '2017-06-22',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 添加IP白名单
 *
 * @param request AddIpfilterRequest
 * @return AddIpfilterResponse
 */
async function addIpfilter(request: AddIpfilterRequest): AddIpfilterResponse {
  var runtime = new Util.RuntimeOptions{};
  return addIpfilterWithOptions(request, runtime);
}

model BatchSendMailRequest {
  accountName?: string(name='AccountName', description='This parameter is required.'),
  addressType?: int32(name='AddressType', description='This parameter is required.'),
  clickTrace?: string(name='ClickTrace'),
  ownerId?: long(name='OwnerId'),
  receiversName?: string(name='ReceiversName', description='This parameter is required.'),
  replyAddress?: string(name='ReplyAddress'),
  replyAddressAlias?: string(name='ReplyAddressAlias'),
  resourceOwnerAccount?: string(name='ResourceOwnerAccount'),
  resourceOwnerId?: long(name='ResourceOwnerId'),
  tagName?: string(name='TagName'),
  templateName?: string(name='TemplateName', description='This parameter is required.'),
  unSubscribeFilterLevel?: string(name='UnSubscribeFilterLevel'),
  unSubscribeLinkType?: string(name='UnSubscribeLinkType'),
}

model BatchSendMailResponseBody = {
  envId?: string(name='EnvId'),
  requestId?: string(name='RequestId'),
}

model BatchSendMailResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: BatchSendMailResponseBody(name='body'),
}

/**
 * @param request BatchSendMailRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return BatchSendMailResponse
 */
async function batchSendMailWithOptions(request: BatchSendMailRequest, runtime: Util.RuntimeOptions): BatchSendMailResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.accountName)) {
    query['AccountName'] = request.accountName;
  }
  if (!Util.isUnset(request.addressType)) {
    query['AddressType'] = request.addressType;
  }
  if (!Util.isUnset(request.clickTrace)) {
    query['ClickTrace'] = request.clickTrace;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!Util.isUnset(request.receiversName)) {
    query['ReceiversName'] = request.receiversName;
  }
  if (!Util.isUnset(request.replyAddress)) {
    query['ReplyAddress'] = request.replyAddress;
  }
  if (!Util.isUnset(request.replyAddressAlias)) {
    query['ReplyAddressAlias'] = request.replyAddressAlias;
  }
  if (!Util.isUnset(request.resourceOwnerAccount)) {
    query['ResourceOwnerAccount'] = request.resourceOwnerAccount;
  }
  if (!Util.isUnset(request.resourceOwnerId)) {
    query['ResourceOwnerId'] = request.resourceOwnerId;
  }
  if (!Util.isUnset(request.tagName)) {
    query['TagName'] = request.tagName;
  }
  if (!Util.isUnset(request.templateName)) {
    query['TemplateName'] = request.templateName;
  }
  if (!Util.isUnset(request.unSubscribeFilterLevel)) {
    query['UnSubscribeFilterLevel'] = request.unSubscribeFilterLevel;
  }
  if (!Util.isUnset(request.unSubscribeLinkType)) {
    query['UnSubscribeLinkType'] = request.unSubscribeLinkType;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'BatchSendMail',
    version = '2017-06-22',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @param request BatchSendMailRequest
 * @return BatchSendMailResponse
 */
async function batchSendMail(request: BatchSendMailRequest): BatchSendMailResponse {
  var runtime = new Util.RuntimeOptions{};
  return batchSendMailWithOptions(request, runtime);
}

model CheckDomainRequest {
  domainId?: int32(name='DomainId', description='This parameter is required.'),
  ownerId?: long(name='OwnerId'),
  resourceOwnerAccount?: string(name='ResourceOwnerAccount'),
  resourceOwnerId?: long(name='ResourceOwnerId'),
}

model CheckDomainResponseBody = {
  domainStatus?: string(name='DomainStatus'),
  requestId?: string(name='RequestId'),
}

model CheckDomainResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: CheckDomainResponseBody(name='body'),
}

/**
 * @summary 校验域名状态
 *
 * @param request CheckDomainRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return CheckDomainResponse
 */
async function checkDomainWithOptions(request: CheckDomainRequest, runtime: Util.RuntimeOptions): CheckDomainResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.domainId)) {
    query['DomainId'] = request.domainId;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!Util.isUnset(request.resourceOwnerAccount)) {
    query['ResourceOwnerAccount'] = request.resourceOwnerAccount;
  }
  if (!Util.isUnset(request.resourceOwnerId)) {
    query['ResourceOwnerId'] = request.resourceOwnerId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'CheckDomain',
    version = '2017-06-22',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 校验域名状态
 *
 * @param request CheckDomainRequest
 * @return CheckDomainResponse
 */
async function checkDomain(request: CheckDomainRequest): CheckDomainResponse {
  var runtime = new Util.RuntimeOptions{};
  return checkDomainWithOptions(request, runtime);
}

model CheckDomainDnsRequest {
  domainId?: int32(name='DomainId', description='This parameter is required.'),
  ownerId?: long(name='OwnerId'),
  resourceOwnerAccount?: string(name='ResourceOwnerAccount'),
  resourceOwnerId?: long(name='ResourceOwnerId'),
  type?: string(name='Type'),
}

model CheckDomainDnsResponseBody = {
  requestId?: string(name='RequestId'),
  status?: int32(name='Status'),
}

model CheckDomainDnsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: CheckDomainDnsResponseBody(name='body'),
}

/**
 * @summary 校验域名Dns状态
 *
 * @param request CheckDomainDnsRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return CheckDomainDnsResponse
 */
async function checkDomainDnsWithOptions(request: CheckDomainDnsRequest, runtime: Util.RuntimeOptions): CheckDomainDnsResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.domainId)) {
    query['DomainId'] = request.domainId;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!Util.isUnset(request.resourceOwnerAccount)) {
    query['ResourceOwnerAccount'] = request.resourceOwnerAccount;
  }
  if (!Util.isUnset(request.resourceOwnerId)) {
    query['ResourceOwnerId'] = request.resourceOwnerId;
  }
  if (!Util.isUnset(request.type)) {
    query['Type'] = request.type;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'CheckDomainDns',
    version = '2017-06-22',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 校验域名Dns状态
 *
 * @param request CheckDomainDnsRequest
 * @return CheckDomainDnsResponse
 */
async function checkDomainDns(request: CheckDomainDnsRequest): CheckDomainDnsResponse {
  var runtime = new Util.RuntimeOptions{};
  return checkDomainDnsWithOptions(request, runtime);
}

model CreateDomainRequest {
  domainName?: string(name='DomainName', description='This parameter is required.'),
  ownerId?: long(name='OwnerId'),
  resourceOwnerAccount?: string(name='ResourceOwnerAccount'),
  resourceOwnerId?: long(name='ResourceOwnerId'),
}

model CreateDomainResponseBody = {
  domainId?: string(name='DomainId'),
  requestId?: string(name='RequestId'),
}

model CreateDomainResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: CreateDomainResponseBody(name='body'),
}

/**
 * @param request CreateDomainRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return CreateDomainResponse
 */
async function createDomainWithOptions(request: CreateDomainRequest, runtime: Util.RuntimeOptions): CreateDomainResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.domainName)) {
    query['DomainName'] = request.domainName;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!Util.isUnset(request.resourceOwnerAccount)) {
    query['ResourceOwnerAccount'] = request.resourceOwnerAccount;
  }
  if (!Util.isUnset(request.resourceOwnerId)) {
    query['ResourceOwnerId'] = request.resourceOwnerId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'CreateDomain',
    version = '2017-06-22',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @param request CreateDomainRequest
 * @return CreateDomainResponse
 */
async function createDomain(request: CreateDomainRequest): CreateDomainResponse {
  var runtime = new Util.RuntimeOptions{};
  return createDomainWithOptions(request, runtime);
}

model CreateMailAddressRequest {
  accountName?: string(name='AccountName', description='This parameter is required.'),
  ownerId?: long(name='OwnerId'),
  replyAddress?: string(name='ReplyAddress'),
  resourceOwnerAccount?: string(name='ResourceOwnerAccount'),
  resourceOwnerId?: long(name='ResourceOwnerId'),
  sendtype?: string(name='Sendtype', description='This parameter is required.'),
}

model CreateMailAddressResponseBody = {
  mailAddressId?: string(name='MailAddressId'),
  requestId?: string(name='RequestId'),
}

model CreateMailAddressResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: CreateMailAddressResponseBody(name='body'),
}

/**
 * @param request CreateMailAddressRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return CreateMailAddressResponse
 */
async function createMailAddressWithOptions(request: CreateMailAddressRequest, runtime: Util.RuntimeOptions): CreateMailAddressResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.accountName)) {
    query['AccountName'] = request.accountName;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!Util.isUnset(request.replyAddress)) {
    query['ReplyAddress'] = request.replyAddress;
  }
  if (!Util.isUnset(request.resourceOwnerAccount)) {
    query['ResourceOwnerAccount'] = request.resourceOwnerAccount;
  }
  if (!Util.isUnset(request.resourceOwnerId)) {
    query['ResourceOwnerId'] = request.resourceOwnerId;
  }
  if (!Util.isUnset(request.sendtype)) {
    query['Sendtype'] = request.sendtype;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'CreateMailAddress',
    version = '2017-06-22',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @param request CreateMailAddressRequest
 * @return CreateMailAddressResponse
 */
async function createMailAddress(request: CreateMailAddressRequest): CreateMailAddressResponse {
  var runtime = new Util.RuntimeOptions{};
  return createMailAddressWithOptions(request, runtime);
}

model CreateReceiverRequest {
  desc?: string(name='Desc'),
  ownerId?: long(name='OwnerId'),
  receiversAlias?: string(name='ReceiversAlias', description='This parameter is required.'),
  receiversName?: string(name='ReceiversName', description='This parameter is required.'),
  resourceOwnerAccount?: string(name='ResourceOwnerAccount'),
  resourceOwnerId?: long(name='ResourceOwnerId'),
}

model CreateReceiverResponseBody = {
  receiverId?: string(name='ReceiverId'),
  requestId?: string(name='RequestId'),
}

model CreateReceiverResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: CreateReceiverResponseBody(name='body'),
}

/**
 * @param request CreateReceiverRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return CreateReceiverResponse
 */
async function createReceiverWithOptions(request: CreateReceiverRequest, runtime: Util.RuntimeOptions): CreateReceiverResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.desc)) {
    query['Desc'] = request.desc;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!Util.isUnset(request.receiversAlias)) {
    query['ReceiversAlias'] = request.receiversAlias;
  }
  if (!Util.isUnset(request.receiversName)) {
    query['ReceiversName'] = request.receiversName;
  }
  if (!Util.isUnset(request.resourceOwnerAccount)) {
    query['ResourceOwnerAccount'] = request.resourceOwnerAccount;
  }
  if (!Util.isUnset(request.resourceOwnerId)) {
    query['ResourceOwnerId'] = request.resourceOwnerId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'CreateReceiver',
    version = '2017-06-22',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @param request CreateReceiverRequest
 * @return CreateReceiverResponse
 */
async function createReceiver(request: CreateReceiverRequest): CreateReceiverResponse {
  var runtime = new Util.RuntimeOptions{};
  return createReceiverWithOptions(request, runtime);
}

model CreateTagRequest {
  ownerId?: long(name='OwnerId'),
  resourceOwnerAccount?: string(name='ResourceOwnerAccount'),
  resourceOwnerId?: long(name='ResourceOwnerId'),
  tagDescription?: string(name='TagDescription', example='test description'),
  tagName?: string(name='TagName', description='This parameter is required.', example='test'),
}

model CreateTagResponseBody = {
  requestId?: string(name='RequestId'),
  tagId?: string(name='TagId'),
}

model CreateTagResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: CreateTagResponseBody(name='body'),
}

/**
 * @param request CreateTagRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return CreateTagResponse
 */
async function createTagWithOptions(request: CreateTagRequest, runtime: Util.RuntimeOptions): CreateTagResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!Util.isUnset(request.resourceOwnerAccount)) {
    query['ResourceOwnerAccount'] = request.resourceOwnerAccount;
  }
  if (!Util.isUnset(request.resourceOwnerId)) {
    query['ResourceOwnerId'] = request.resourceOwnerId;
  }
  if (!Util.isUnset(request.tagDescription)) {
    query['TagDescription'] = request.tagDescription;
  }
  if (!Util.isUnset(request.tagName)) {
    query['TagName'] = request.tagName;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'CreateTag',
    version = '2017-06-22',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @param request CreateTagRequest
 * @return CreateTagResponse
 */
async function createTag(request: CreateTagRequest): CreateTagResponse {
  var runtime = new Util.RuntimeOptions{};
  return createTagWithOptions(request, runtime);
}

model CreateTemplateRequest {
  fromType?: int32(name='FromType'),
  ownerId?: long(name='OwnerId'),
  remark?: string(name='Remark'),
  resourceOwnerAccount?: string(name='ResourceOwnerAccount'),
  resourceOwnerId?: long(name='ResourceOwnerId'),
  smsContent?: string(name='SmsContent'),
  smsType?: int32(name='SmsType'),
  templateName?: string(name='TemplateName', description='This parameter is required.'),
  templateNickName?: string(name='TemplateNickName'),
  templateSubject?: string(name='TemplateSubject'),
  templateText?: string(name='TemplateText'),
  templateType?: int32(name='TemplateType'),
}

model CreateTemplateResponseBody = {
  requestId?: string(name='RequestId'),
  templateId?: int32(name='TemplateId'),
}

model CreateTemplateResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: CreateTemplateResponseBody(name='body'),
}

/**
 * @param request CreateTemplateRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return CreateTemplateResponse
 */
async function createTemplateWithOptions(request: CreateTemplateRequest, runtime: Util.RuntimeOptions): CreateTemplateResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.fromType)) {
    query['FromType'] = request.fromType;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!Util.isUnset(request.remark)) {
    query['Remark'] = request.remark;
  }
  if (!Util.isUnset(request.resourceOwnerAccount)) {
    query['ResourceOwnerAccount'] = request.resourceOwnerAccount;
  }
  if (!Util.isUnset(request.resourceOwnerId)) {
    query['ResourceOwnerId'] = request.resourceOwnerId;
  }
  if (!Util.isUnset(request.smsContent)) {
    query['SmsContent'] = request.smsContent;
  }
  if (!Util.isUnset(request.smsType)) {
    query['SmsType'] = request.smsType;
  }
  if (!Util.isUnset(request.templateName)) {
    query['TemplateName'] = request.templateName;
  }
  if (!Util.isUnset(request.templateNickName)) {
    query['TemplateNickName'] = request.templateNickName;
  }
  if (!Util.isUnset(request.templateSubject)) {
    query['TemplateSubject'] = request.templateSubject;
  }
  if (!Util.isUnset(request.templateText)) {
    query['TemplateText'] = request.templateText;
  }
  if (!Util.isUnset(request.templateType)) {
    query['TemplateType'] = request.templateType;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'CreateTemplate',
    version = '2017-06-22',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @param request CreateTemplateRequest
 * @return CreateTemplateResponse
 */
async function createTemplate(request: CreateTemplateRequest): CreateTemplateResponse {
  var runtime = new Util.RuntimeOptions{};
  return createTemplateWithOptions(request, runtime);
}

model DeleteDomainRequest {
  domainId?: int32(name='DomainId', description='This parameter is required.'),
  ownerId?: long(name='OwnerId'),
  resourceOwnerAccount?: string(name='ResourceOwnerAccount'),
  resourceOwnerId?: long(name='ResourceOwnerId'),
}

model DeleteDomainResponseBody = {
  requestId?: string(name='RequestId'),
}

model DeleteDomainResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DeleteDomainResponseBody(name='body'),
}

/**
 * @param request DeleteDomainRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DeleteDomainResponse
 */
async function deleteDomainWithOptions(request: DeleteDomainRequest, runtime: Util.RuntimeOptions): DeleteDomainResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.domainId)) {
    query['DomainId'] = request.domainId;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!Util.isUnset(request.resourceOwnerAccount)) {
    query['ResourceOwnerAccount'] = request.resourceOwnerAccount;
  }
  if (!Util.isUnset(request.resourceOwnerId)) {
    query['ResourceOwnerId'] = request.resourceOwnerId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DeleteDomain',
    version = '2017-06-22',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @param request DeleteDomainRequest
 * @return DeleteDomainResponse
 */
async function deleteDomain(request: DeleteDomainRequest): DeleteDomainResponse {
  var runtime = new Util.RuntimeOptions{};
  return deleteDomainWithOptions(request, runtime);
}

model DeleteMailAddressRequest {
  mailAddressId?: int32(name='MailAddressId', description='This parameter is required.'),
  ownerId?: long(name='OwnerId'),
  resourceOwnerAccount?: string(name='ResourceOwnerAccount'),
  resourceOwnerId?: long(name='ResourceOwnerId'),
}

model DeleteMailAddressResponseBody = {
  requestId?: string(name='RequestId'),
}

model DeleteMailAddressResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DeleteMailAddressResponseBody(name='body'),
}

/**
 * @param request DeleteMailAddressRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DeleteMailAddressResponse
 */
async function deleteMailAddressWithOptions(request: DeleteMailAddressRequest, runtime: Util.RuntimeOptions): DeleteMailAddressResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.mailAddressId)) {
    query['MailAddressId'] = request.mailAddressId;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!Util.isUnset(request.resourceOwnerAccount)) {
    query['ResourceOwnerAccount'] = request.resourceOwnerAccount;
  }
  if (!Util.isUnset(request.resourceOwnerId)) {
    query['ResourceOwnerId'] = request.resourceOwnerId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DeleteMailAddress',
    version = '2017-06-22',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @param request DeleteMailAddressRequest
 * @return DeleteMailAddressResponse
 */
async function deleteMailAddress(request: DeleteMailAddressRequest): DeleteMailAddressResponse {
  var runtime = new Util.RuntimeOptions{};
  return deleteMailAddressWithOptions(request, runtime);
}

model DeleteReceiverRequest {
  ownerId?: long(name='OwnerId'),
  receiverId?: string(name='ReceiverId', description='This parameter is required.'),
  resourceOwnerAccount?: string(name='ResourceOwnerAccount'),
  resourceOwnerId?: long(name='ResourceOwnerId'),
}

model DeleteReceiverResponseBody = {
  requestId?: string(name='RequestId'),
}

model DeleteReceiverResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DeleteReceiverResponseBody(name='body'),
}

/**
 * @param request DeleteReceiverRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DeleteReceiverResponse
 */
async function deleteReceiverWithOptions(request: DeleteReceiverRequest, runtime: Util.RuntimeOptions): DeleteReceiverResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!Util.isUnset(request.receiverId)) {
    query['ReceiverId'] = request.receiverId;
  }
  if (!Util.isUnset(request.resourceOwnerAccount)) {
    query['ResourceOwnerAccount'] = request.resourceOwnerAccount;
  }
  if (!Util.isUnset(request.resourceOwnerId)) {
    query['ResourceOwnerId'] = request.resourceOwnerId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DeleteReceiver',
    version = '2017-06-22',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @param request DeleteReceiverRequest
 * @return DeleteReceiverResponse
 */
async function deleteReceiver(request: DeleteReceiverRequest): DeleteReceiverResponse {
  var runtime = new Util.RuntimeOptions{};
  return deleteReceiverWithOptions(request, runtime);
}

model DeleteReceiverDetailRequest {
  email?: string(name='Email'),
  ownerId?: long(name='OwnerId'),
  receiverId?: string(name='ReceiverId', description='This parameter is required.'),
  resourceOwnerAccount?: string(name='ResourceOwnerAccount'),
  resourceOwnerId?: long(name='ResourceOwnerId'),
}

model DeleteReceiverDetailResponseBody = {
  requestId?: string(name='RequestId'),
}

model DeleteReceiverDetailResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DeleteReceiverDetailResponseBody(name='body'),
}

/**
 * @param request DeleteReceiverDetailRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DeleteReceiverDetailResponse
 */
async function deleteReceiverDetailWithOptions(request: DeleteReceiverDetailRequest, runtime: Util.RuntimeOptions): DeleteReceiverDetailResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.email)) {
    query['Email'] = request.email;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!Util.isUnset(request.receiverId)) {
    query['ReceiverId'] = request.receiverId;
  }
  if (!Util.isUnset(request.resourceOwnerAccount)) {
    query['ResourceOwnerAccount'] = request.resourceOwnerAccount;
  }
  if (!Util.isUnset(request.resourceOwnerId)) {
    query['ResourceOwnerId'] = request.resourceOwnerId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DeleteReceiverDetail',
    version = '2017-06-22',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @param request DeleteReceiverDetailRequest
 * @return DeleteReceiverDetailResponse
 */
async function deleteReceiverDetail(request: DeleteReceiverDetailRequest): DeleteReceiverDetailResponse {
  var runtime = new Util.RuntimeOptions{};
  return deleteReceiverDetailWithOptions(request, runtime);
}

model DeleteTagRequest {
  ownerId?: long(name='OwnerId'),
  resourceOwnerAccount?: string(name='ResourceOwnerAccount'),
  resourceOwnerId?: long(name='ResourceOwnerId'),
  tagId?: int32(name='TagId', description='This parameter is required.'),
}

model DeleteTagResponseBody = {
  requestId?: string(name='RequestId'),
}

model DeleteTagResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DeleteTagResponseBody(name='body'),
}

/**
 * @param request DeleteTagRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DeleteTagResponse
 */
async function deleteTagWithOptions(request: DeleteTagRequest, runtime: Util.RuntimeOptions): DeleteTagResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!Util.isUnset(request.resourceOwnerAccount)) {
    query['ResourceOwnerAccount'] = request.resourceOwnerAccount;
  }
  if (!Util.isUnset(request.resourceOwnerId)) {
    query['ResourceOwnerId'] = request.resourceOwnerId;
  }
  if (!Util.isUnset(request.tagId)) {
    query['TagId'] = request.tagId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DeleteTag',
    version = '2017-06-22',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @param request DeleteTagRequest
 * @return DeleteTagResponse
 */
async function deleteTag(request: DeleteTagRequest): DeleteTagResponse {
  var runtime = new Util.RuntimeOptions{};
  return deleteTagWithOptions(request, runtime);
}

model DeleteTemplateRequest {
  fromType?: int32(name='FromType'),
  ownerId?: long(name='OwnerId'),
  resourceOwnerAccount?: string(name='ResourceOwnerAccount'),
  resourceOwnerId?: long(name='ResourceOwnerId'),
  templateId?: int32(name='TemplateId', description='This parameter is required.'),
}

model DeleteTemplateResponseBody = {
  requestId?: string(name='RequestId'),
}

model DeleteTemplateResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DeleteTemplateResponseBody(name='body'),
}

/**
 * @param request DeleteTemplateRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DeleteTemplateResponse
 */
async function deleteTemplateWithOptions(request: DeleteTemplateRequest, runtime: Util.RuntimeOptions): DeleteTemplateResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.fromType)) {
    query['FromType'] = request.fromType;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!Util.isUnset(request.resourceOwnerAccount)) {
    query['ResourceOwnerAccount'] = request.resourceOwnerAccount;
  }
  if (!Util.isUnset(request.resourceOwnerId)) {
    query['ResourceOwnerId'] = request.resourceOwnerId;
  }
  if (!Util.isUnset(request.templateId)) {
    query['TemplateId'] = request.templateId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DeleteTemplate',
    version = '2017-06-22',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @param request DeleteTemplateRequest
 * @return DeleteTemplateResponse
 */
async function deleteTemplate(request: DeleteTemplateRequest): DeleteTemplateResponse {
  var runtime = new Util.RuntimeOptions{};
  return deleteTemplateWithOptions(request, runtime);
}

model DescAccountSummaryRequest {
  ownerId?: long(name='OwnerId'),
  resourceOwnerAccount?: string(name='ResourceOwnerAccount'),
  resourceOwnerId?: long(name='ResourceOwnerId'),
}

model DescAccountSummaryResponseBody = {
  dailyQuota?: int32(name='DailyQuota'),
  dailyRemainFreeQuota?: string(name='DailyRemainFreeQuota'),
  dayuStatus?: int32(name='DayuStatus'),
  domains?: int32(name='Domains'),
  enableTimes?: int32(name='EnableTimes'),
  mailAddresses?: int32(name='MailAddresses'),
  maxQuotaLevel?: int32(name='MaxQuotaLevel'),
  monthQuota?: int32(name='MonthQuota'),
  quotaLevel?: int32(name='QuotaLevel'),
  receivers?: int32(name='Receivers'),
  remainFreeQuota?: int32(name='RemainFreeQuota'),
  requestId?: string(name='RequestId'),
  smsRecord?: int32(name='SmsRecord'),
  smsSign?: int32(name='SmsSign'),
  smsTemplates?: int32(name='SmsTemplates'),
  tags?: int32(name='Tags'),
  templates?: int32(name='Templates'),
  userStatus?: int32(name='UserStatus'),
}

model DescAccountSummaryResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescAccountSummaryResponseBody(name='body'),
}

/**
 * @param request DescAccountSummaryRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescAccountSummaryResponse
 */
async function descAccountSummaryWithOptions(request: DescAccountSummaryRequest, runtime: Util.RuntimeOptions): DescAccountSummaryResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!Util.isUnset(request.resourceOwnerAccount)) {
    query['ResourceOwnerAccount'] = request.resourceOwnerAccount;
  }
  if (!Util.isUnset(request.resourceOwnerId)) {
    query['ResourceOwnerId'] = request.resourceOwnerId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescAccountSummary',
    version = '2017-06-22',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @param request DescAccountSummaryRequest
 * @return DescAccountSummaryResponse
 */
async function descAccountSummary(request: DescAccountSummaryRequest): DescAccountSummaryResponse {
  var runtime = new Util.RuntimeOptions{};
  return descAccountSummaryWithOptions(request, runtime);
}

model DescDomainRequest {
  domainId?: int32(name='DomainId', description='This parameter is required.'),
  ownerId?: long(name='OwnerId'),
  requireRealTimeDnsRecords?: boolean(name='RequireRealTimeDnsRecords'),
  resourceOwnerAccount?: string(name='ResourceOwnerAccount'),
  resourceOwnerId?: long(name='ResourceOwnerId'),
}

model DescDomainResponseBody = {
  cnameAuthStatus?: string(name='CnameAuthStatus'),
  cnameConfirmStatus?: string(name='CnameConfirmStatus'),
  cnameRecord?: string(name='CnameRecord'),
  createTime?: string(name='CreateTime'),
  defaultDomain?: string(name='DefaultDomain'),
  dkimAuthStatus?: string(name='DkimAuthStatus'),
  dkimPublicKey?: string(name='DkimPublicKey'),
  dkimRR?: string(name='DkimRR'),
  dmarcAuthStatus?: int32(name='DmarcAuthStatus'),
  dmarcHostRecord?: string(name='DmarcHostRecord'),
  dmarcRecord?: string(name='DmarcRecord'),
  dnsDmarc?: string(name='DnsDmarc'),
  dnsMx?: string(name='DnsMx'),
  dnsSpf?: string(name='DnsSpf'),
  dnsTxt?: string(name='DnsTxt'),
  domainId?: string(name='DomainId'),
  domainName?: string(name='DomainName'),
  domainStatus?: string(name='DomainStatus'),
  domainType?: string(name='DomainType'),
  hostRecord?: string(name='HostRecord'),
  icpStatus?: string(name='IcpStatus'),
  mxAuthStatus?: string(name='MxAuthStatus'),
  mxRecord?: string(name='MxRecord'),
  requestId?: string(name='RequestId'),
  spfAuthStatus?: string(name='SpfAuthStatus'),
  spfRecord?: string(name='SpfRecord'),
  spfRecordV2?: string(name='SpfRecordV2'),
  tlDomainName?: string(name='TlDomainName'),
  tracefRecord?: string(name='TracefRecord'),
}

model DescDomainResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescDomainResponseBody(name='body'),
}

/**
 * @param request DescDomainRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescDomainResponse
 */
async function descDomainWithOptions(request: DescDomainRequest, runtime: Util.RuntimeOptions): DescDomainResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.domainId)) {
    query['DomainId'] = request.domainId;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!Util.isUnset(request.requireRealTimeDnsRecords)) {
    query['RequireRealTimeDnsRecords'] = request.requireRealTimeDnsRecords;
  }
  if (!Util.isUnset(request.resourceOwnerAccount)) {
    query['ResourceOwnerAccount'] = request.resourceOwnerAccount;
  }
  if (!Util.isUnset(request.resourceOwnerId)) {
    query['ResourceOwnerId'] = request.resourceOwnerId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescDomain',
    version = '2017-06-22',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @param request DescDomainRequest
 * @return DescDomainResponse
 */
async function descDomain(request: DescDomainRequest): DescDomainResponse {
  var runtime = new Util.RuntimeOptions{};
  return descDomainWithOptions(request, runtime);
}

model DescTemplateRequest {
  fromType?: int32(name='FromType'),
  ownerId?: long(name='OwnerId'),
  resourceOwnerAccount?: string(name='ResourceOwnerAccount'),
  resourceOwnerId?: long(name='ResourceOwnerId'),
  templateId?: int32(name='TemplateId', description='This parameter is required.'),
}

model DescTemplateResponseBody = {
  createTime?: string(name='CreateTime'),
  remark?: string(name='Remark'),
  requestId?: string(name='RequestId'),
  smsContent?: string(name='SmsContent'),
  smsType?: string(name='SmsType'),
  templateName?: string(name='TemplateName'),
  templateNickName?: string(name='TemplateNickName'),
  templateStatus?: string(name='TemplateStatus'),
  templateSubject?: string(name='TemplateSubject'),
  templateText?: string(name='TemplateText'),
  templateType?: string(name='TemplateType'),
}

model DescTemplateResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescTemplateResponseBody(name='body'),
}

/**
 * @param request DescTemplateRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescTemplateResponse
 */
async function descTemplateWithOptions(request: DescTemplateRequest, runtime: Util.RuntimeOptions): DescTemplateResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.fromType)) {
    query['FromType'] = request.fromType;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!Util.isUnset(request.resourceOwnerAccount)) {
    query['ResourceOwnerAccount'] = request.resourceOwnerAccount;
  }
  if (!Util.isUnset(request.resourceOwnerId)) {
    query['ResourceOwnerId'] = request.resourceOwnerId;
  }
  if (!Util.isUnset(request.templateId)) {
    query['TemplateId'] = request.templateId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescTemplate',
    version = '2017-06-22',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @param request DescTemplateRequest
 * @return DescTemplateResponse
 */
async function descTemplate(request: DescTemplateRequest): DescTemplateResponse {
  var runtime = new Util.RuntimeOptions{};
  return descTemplateWithOptions(request, runtime);
}

model GetAccountListRequest {
  offset?: string(name='Offset'),
  offsetCreateTime?: string(name='OffsetCreateTime'),
  offsetCreateTimeDesc?: string(name='OffsetCreateTimeDesc'),
  ownerId?: long(name='OwnerId'),
  pageNumber?: string(name='PageNumber'),
  pageSize?: string(name='PageSize'),
  resourceOwnerAccount?: string(name='ResourceOwnerAccount'),
  resourceOwnerId?: long(name='ResourceOwnerId'),
  total?: string(name='Total'),
}

model GetAccountListResponseBody = {
  pageNo?: int32(name='PageNo'),
  pageSize?: int32(name='PageSize'),
  requestId?: string(name='RequestId'),
  total?: int32(name='Total'),
  data?: {
    accountNotificationInfo?: [ 
    {
      region?: string(name='Region'),
      status?: string(name='Status'),
      updateTime?: string(name='UpdateTime'),
    }
  ](name='accountNotificationInfo')
  }(name='data'),
}

model GetAccountListResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetAccountListResponseBody(name='body'),
}

/**
 * @param request GetAccountListRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetAccountListResponse
 */
async function getAccountListWithOptions(request: GetAccountListRequest, runtime: Util.RuntimeOptions): GetAccountListResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.offset)) {
    query['Offset'] = request.offset;
  }
  if (!Util.isUnset(request.offsetCreateTime)) {
    query['OffsetCreateTime'] = request.offsetCreateTime;
  }
  if (!Util.isUnset(request.offsetCreateTimeDesc)) {
    query['OffsetCreateTimeDesc'] = request.offsetCreateTimeDesc;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!Util.isUnset(request.pageNumber)) {
    query['PageNumber'] = request.pageNumber;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.resourceOwnerAccount)) {
    query['ResourceOwnerAccount'] = request.resourceOwnerAccount;
  }
  if (!Util.isUnset(request.resourceOwnerId)) {
    query['ResourceOwnerId'] = request.resourceOwnerId;
  }
  if (!Util.isUnset(request.total)) {
    query['Total'] = request.total;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'GetAccountList',
    version = '2017-06-22',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @param request GetAccountListRequest
 * @return GetAccountListResponse
 */
async function getAccountList(request: GetAccountListRequest): GetAccountListResponse {
  var runtime = new Util.RuntimeOptions{};
  return getAccountListWithOptions(request, runtime);
}

model GetMailAddressMsgCallBackUrlRequest {
  mailFrom?: string(name='MailFrom', description='This parameter is required.'),
  ownerId?: long(name='OwnerId'),
  resourceOwnerAccount?: string(name='ResourceOwnerAccount'),
  resourceOwnerId?: long(name='ResourceOwnerId'),
}

model GetMailAddressMsgCallBackUrlResponseBody = {
  notifyUrl?: int32(name='NotifyUrl'),
  notifyUrlStatus?: int32(name='NotifyUrlStatus'),
  requestId?: string(name='RequestId'),
}

model GetMailAddressMsgCallBackUrlResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetMailAddressMsgCallBackUrlResponseBody(name='body'),
}

/**
 * @deprecated OpenAPI GetMailAddressMsgCallBackUrl is deprecated
 *
 * @summary 查询发信地址消息回调地址信息
 *
 * @param request GetMailAddressMsgCallBackUrlRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetMailAddressMsgCallBackUrlResponse
 */
// Deprecated
async function getMailAddressMsgCallBackUrlWithOptions(request: GetMailAddressMsgCallBackUrlRequest, runtime: Util.RuntimeOptions): GetMailAddressMsgCallBackUrlResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.mailFrom)) {
    query['MailFrom'] = request.mailFrom;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!Util.isUnset(request.resourceOwnerAccount)) {
    query['ResourceOwnerAccount'] = request.resourceOwnerAccount;
  }
  if (!Util.isUnset(request.resourceOwnerId)) {
    query['ResourceOwnerId'] = request.resourceOwnerId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'GetMailAddressMsgCallBackUrl',
    version = '2017-06-22',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @deprecated OpenAPI GetMailAddressMsgCallBackUrl is deprecated
 *
 * @summary 查询发信地址消息回调地址信息
 *
 * @param request GetMailAddressMsgCallBackUrlRequest
 * @return GetMailAddressMsgCallBackUrlResponse
 */
// Deprecated
async function getMailAddressMsgCallBackUrl(request: GetMailAddressMsgCallBackUrlRequest): GetMailAddressMsgCallBackUrlResponse {
  var runtime = new Util.RuntimeOptions{};
  return getMailAddressMsgCallBackUrlWithOptions(request, runtime);
}

model GetTrackListRequest {
  accountName?: string(name='AccountName'),
  endTime?: string(name='EndTime', description='This parameter is required.', example='2022-09-29'),
  offset?: string(name='Offset'),
  offsetCreateTime?: string(name='OffsetCreateTime'),
  offsetCreateTimeDesc?: string(name='OffsetCreateTimeDesc'),
  ownerId?: long(name='OwnerId'),
  pageNumber?: string(name='PageNumber', example='1'),
  pageSize?: string(name='PageSize', example='10'),
  resourceOwnerAccount?: string(name='ResourceOwnerAccount'),
  resourceOwnerId?: long(name='ResourceOwnerId'),
  startTime?: string(name='StartTime', description='This parameter is required.', example='2022-09-29'),
  tagName?: string(name='TagName'),
  total?: string(name='Total'),
}

model GetTrackListResponseBody = {
  offsetCreateTime?: string(name='OffsetCreateTime'),
  offsetCreateTimeDesc?: string(name='OffsetCreateTimeDesc'),
  pageNo?: int32(name='PageNo', example='1'),
  pageSize?: int32(name='PageSize', example='10'),
  requestId?: string(name='RequestId', example='10A1AD70-E48E-476D-98D9-39BD92193837'),
  total?: int32(name='Total', example='100'),
  data?: {
    stat?: [ 
    {
      createTime?: long(name='CreateTime', example='2019-09-29T13:28Z'),
      rcptClickCount?: long(name='RcptClickCount', example='0'),
      rcptClickRate?: string(name='RcptClickRate', example='0'),
      rcptOpenCount?: long(name='RcptOpenCount', example='0'),
      rcptOpenRate?: string(name='RcptOpenRate', example='0'),
      rcptUniqueClickCount?: long(name='RcptUniqueClickCount', example='0'),
      rcptUniqueClickRate?: string(name='RcptUniqueClickRate', example='0'),
      rcptUniqueOpenCount?: long(name='RcptUniqueOpenCount', example='0'),
      rcptUniqueOpenRate?: string(name='RcptUniqueOpenRate', example='0'),
      totalNumber?: long(name='TotalNumber', example='0'),
    }
  ](name='stat')
  }(name='data'),
}

model GetTrackListResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetTrackListResponseBody(name='body'),
}

/**
 * @summary 获取打开、点击等跟踪行为的统计结果
 *
 * @param request GetTrackListRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetTrackListResponse
 */
async function getTrackListWithOptions(request: GetTrackListRequest, runtime: Util.RuntimeOptions): GetTrackListResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.accountName)) {
    query['AccountName'] = request.accountName;
  }
  if (!Util.isUnset(request.endTime)) {
    query['EndTime'] = request.endTime;
  }
  if (!Util.isUnset(request.offset)) {
    query['Offset'] = request.offset;
  }
  if (!Util.isUnset(request.offsetCreateTime)) {
    query['OffsetCreateTime'] = request.offsetCreateTime;
  }
  if (!Util.isUnset(request.offsetCreateTimeDesc)) {
    query['OffsetCreateTimeDesc'] = request.offsetCreateTimeDesc;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!Util.isUnset(request.pageNumber)) {
    query['PageNumber'] = request.pageNumber;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.resourceOwnerAccount)) {
    query['ResourceOwnerAccount'] = request.resourceOwnerAccount;
  }
  if (!Util.isUnset(request.resourceOwnerId)) {
    query['ResourceOwnerId'] = request.resourceOwnerId;
  }
  if (!Util.isUnset(request.startTime)) {
    query['StartTime'] = request.startTime;
  }
  if (!Util.isUnset(request.tagName)) {
    query['TagName'] = request.tagName;
  }
  if (!Util.isUnset(request.total)) {
    query['Total'] = request.total;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'GetTrackList',
    version = '2017-06-22',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 获取打开、点击等跟踪行为的统计结果
 *
 * @param request GetTrackListRequest
 * @return GetTrackListResponse
 */
async function getTrackList(request: GetTrackListRequest): GetTrackListResponse {
  var runtime = new Util.RuntimeOptions{};
  return getTrackListWithOptions(request, runtime);
}

model ModifyMailAddressRequest {
  mailAddressId?: int32(name='MailAddressId', description='This parameter is required.'),
  ownerId?: long(name='OwnerId'),
  password?: string(name='Password'),
  replyAddress?: string(name='ReplyAddress'),
  resourceOwnerAccount?: string(name='ResourceOwnerAccount'),
  resourceOwnerId?: long(name='ResourceOwnerId'),
}

model ModifyMailAddressResponseBody = {
  requestId?: string(name='RequestId'),
}

model ModifyMailAddressResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ModifyMailAddressResponseBody(name='body'),
}

/**
 * @param request ModifyMailAddressRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ModifyMailAddressResponse
 */
async function modifyMailAddressWithOptions(request: ModifyMailAddressRequest, runtime: Util.RuntimeOptions): ModifyMailAddressResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.mailAddressId)) {
    query['MailAddressId'] = request.mailAddressId;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!Util.isUnset(request.password)) {
    query['Password'] = request.password;
  }
  if (!Util.isUnset(request.replyAddress)) {
    query['ReplyAddress'] = request.replyAddress;
  }
  if (!Util.isUnset(request.resourceOwnerAccount)) {
    query['ResourceOwnerAccount'] = request.resourceOwnerAccount;
  }
  if (!Util.isUnset(request.resourceOwnerId)) {
    query['ResourceOwnerId'] = request.resourceOwnerId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ModifyMailAddress',
    version = '2017-06-22',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @param request ModifyMailAddressRequest
 * @return ModifyMailAddressResponse
 */
async function modifyMailAddress(request: ModifyMailAddressRequest): ModifyMailAddressResponse {
  var runtime = new Util.RuntimeOptions{};
  return modifyMailAddressWithOptions(request, runtime);
}

model ModifyPWByDomainRequest {
  domainName?: string(name='DomainName', description='This parameter is required.'),
  password?: string(name='Password', description='This parameter is required.'),
  resourceOwnerId?: string(name='ResourceOwnerId'),
}

model ModifyPWByDomainResponseBody = {
  code?: string(name='Code'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model ModifyPWByDomainResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ModifyPWByDomainResponseBody(name='body'),
}

/**
 * @param request ModifyPWByDomainRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ModifyPWByDomainResponse
 */
async function modifyPWByDomainWithOptions(request: ModifyPWByDomainRequest, runtime: Util.RuntimeOptions): ModifyPWByDomainResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.domainName)) {
    query['DomainName'] = request.domainName;
  }
  if (!Util.isUnset(request.password)) {
    query['Password'] = request.password;
  }
  if (!Util.isUnset(request.resourceOwnerId)) {
    query['ResourceOwnerId'] = request.resourceOwnerId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ModifyPWByDomain',
    version = '2017-06-22',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @param request ModifyPWByDomainRequest
 * @return ModifyPWByDomainResponse
 */
async function modifyPWByDomain(request: ModifyPWByDomainRequest): ModifyPWByDomainResponse {
  var runtime = new Util.RuntimeOptions{};
  return modifyPWByDomainWithOptions(request, runtime);
}

model ModifyTagRequest {
  ownerId?: long(name='OwnerId'),
  resourceOwnerAccount?: string(name='ResourceOwnerAccount'),
  resourceOwnerId?: long(name='ResourceOwnerId'),
  tagDescription?: string(name='TagDescription', example='test description'),
  tagId?: int32(name='TagId', description='This parameter is required.', example='123'),
  tagName?: string(name='TagName', description='This parameter is required.', example='test'),
}

model ModifyTagResponseBody = {
  requestId?: string(name='RequestId'),
}

model ModifyTagResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ModifyTagResponseBody(name='body'),
}

/**
 * @param request ModifyTagRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ModifyTagResponse
 */
async function modifyTagWithOptions(request: ModifyTagRequest, runtime: Util.RuntimeOptions): ModifyTagResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!Util.isUnset(request.resourceOwnerAccount)) {
    query['ResourceOwnerAccount'] = request.resourceOwnerAccount;
  }
  if (!Util.isUnset(request.resourceOwnerId)) {
    query['ResourceOwnerId'] = request.resourceOwnerId;
  }
  if (!Util.isUnset(request.tagDescription)) {
    query['TagDescription'] = request.tagDescription;
  }
  if (!Util.isUnset(request.tagId)) {
    query['TagId'] = request.tagId;
  }
  if (!Util.isUnset(request.tagName)) {
    query['TagName'] = request.tagName;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ModifyTag',
    version = '2017-06-22',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @param request ModifyTagRequest
 * @return ModifyTagResponse
 */
async function modifyTag(request: ModifyTagRequest): ModifyTagResponse {
  var runtime = new Util.RuntimeOptions{};
  return modifyTagWithOptions(request, runtime);
}

model ModifyTemplateRequest {
  fromType?: int32(name='FromType'),
  ownerId?: long(name='OwnerId'),
  remark?: string(name='Remark'),
  resourceOwnerAccount?: string(name='ResourceOwnerAccount'),
  resourceOwnerId?: long(name='ResourceOwnerId'),
  smsContent?: string(name='SmsContent'),
  smsType?: int32(name='SmsType'),
  templateId?: int32(name='TemplateId', description='This parameter is required.'),
  templateName?: string(name='TemplateName', description='This parameter is required.'),
  templateNickName?: string(name='TemplateNickName'),
  templateSubject?: string(name='TemplateSubject'),
  templateText?: string(name='TemplateText'),
}

model ModifyTemplateResponseBody = {
  requestId?: string(name='RequestId'),
}

model ModifyTemplateResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ModifyTemplateResponseBody(name='body'),
}

/**
 * @summary 修改模板信息
 *
 * @param request ModifyTemplateRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ModifyTemplateResponse
 */
async function modifyTemplateWithOptions(request: ModifyTemplateRequest, runtime: Util.RuntimeOptions): ModifyTemplateResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.fromType)) {
    query['FromType'] = request.fromType;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!Util.isUnset(request.remark)) {
    query['Remark'] = request.remark;
  }
  if (!Util.isUnset(request.resourceOwnerAccount)) {
    query['ResourceOwnerAccount'] = request.resourceOwnerAccount;
  }
  if (!Util.isUnset(request.resourceOwnerId)) {
    query['ResourceOwnerId'] = request.resourceOwnerId;
  }
  if (!Util.isUnset(request.smsContent)) {
    query['SmsContent'] = request.smsContent;
  }
  if (!Util.isUnset(request.smsType)) {
    query['SmsType'] = request.smsType;
  }
  if (!Util.isUnset(request.templateId)) {
    query['TemplateId'] = request.templateId;
  }
  if (!Util.isUnset(request.templateName)) {
    query['TemplateName'] = request.templateName;
  }
  if (!Util.isUnset(request.templateNickName)) {
    query['TemplateNickName'] = request.templateNickName;
  }
  if (!Util.isUnset(request.templateSubject)) {
    query['TemplateSubject'] = request.templateSubject;
  }
  if (!Util.isUnset(request.templateText)) {
    query['TemplateText'] = request.templateText;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ModifyTemplate',
    version = '2017-06-22',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 修改模板信息
 *
 * @param request ModifyTemplateRequest
 * @return ModifyTemplateResponse
 */
async function modifyTemplate(request: ModifyTemplateRequest): ModifyTemplateResponse {
  var runtime = new Util.RuntimeOptions{};
  return modifyTemplateWithOptions(request, runtime);
}

model QueryDomainByParamRequest {
  keyWord?: string(name='KeyWord'),
  ownerId?: long(name='OwnerId'),
  pageNo?: int32(name='PageNo'),
  pageSize?: int32(name='PageSize'),
  resourceOwnerAccount?: string(name='ResourceOwnerAccount'),
  resourceOwnerId?: long(name='ResourceOwnerId'),
  status?: int32(name='Status'),
}

model QueryDomainByParamResponseBody = {
  pageNumber?: int32(name='PageNumber'),
  pageSize?: int32(name='PageSize'),
  requestId?: string(name='RequestId'),
  totalCount?: int32(name='TotalCount'),
  data?: {
    domain?: [ 
    {
      cnameAuthStatus?: string(name='CnameAuthStatus'),
      confirmStatus?: string(name='ConfirmStatus'),
      createTime?: string(name='CreateTime'),
      domainId?: string(name='DomainId'),
      domainName?: string(name='DomainName'),
      domainRecord?: string(name='DomainRecord'),
      domainStatus?: string(name='DomainStatus'),
      icpStatus?: string(name='IcpStatus'),
      mxAuthStatus?: string(name='MxAuthStatus'),
      spfAuthStatus?: string(name='SpfAuthStatus'),
      utcCreateTime?: long(name='UtcCreateTime'),
    }
  ](name='domain')
  }(name='data'),
}

model QueryDomainByParamResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: QueryDomainByParamResponseBody(name='body'),
}

/**
 * @param request QueryDomainByParamRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return QueryDomainByParamResponse
 */
async function queryDomainByParamWithOptions(request: QueryDomainByParamRequest, runtime: Util.RuntimeOptions): QueryDomainByParamResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.keyWord)) {
    query['KeyWord'] = request.keyWord;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!Util.isUnset(request.pageNo)) {
    query['PageNo'] = request.pageNo;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.resourceOwnerAccount)) {
    query['ResourceOwnerAccount'] = request.resourceOwnerAccount;
  }
  if (!Util.isUnset(request.resourceOwnerId)) {
    query['ResourceOwnerId'] = request.resourceOwnerId;
  }
  if (!Util.isUnset(request.status)) {
    query['Status'] = request.status;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'QueryDomainByParam',
    version = '2017-06-22',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @param request QueryDomainByParamRequest
 * @return QueryDomainByParamResponse
 */
async function queryDomainByParam(request: QueryDomainByParamRequest): QueryDomainByParamResponse {
  var runtime = new Util.RuntimeOptions{};
  return queryDomainByParamWithOptions(request, runtime);
}

model QueryInvalidAddressRequest {
  endTime?: string(name='EndTime'),
  keyWord?: string(name='KeyWord'),
  length?: int32(name='Length'),
  nextStart?: string(name='NextStart'),
  ownerId?: long(name='OwnerId'),
  resourceOwnerAccount?: string(name='ResourceOwnerAccount'),
  resourceOwnerId?: long(name='ResourceOwnerId'),
  startTime?: string(name='StartTime'),
}

model QueryInvalidAddressResponseBody = {
  nextStart?: int32(name='NextStart'),
  requestId?: string(name='RequestId'),
  totalCount?: int32(name='TotalCount'),
  data?: {
    mailDetail?: [ 
    {
      lastUpdateTime?: string(name='LastUpdateTime'),
      toAddress?: string(name='ToAddress'),
      utcLastUpdateTime?: long(name='UtcLastUpdateTime'),
    }
  ](name='mailDetail')
  }(name='data'),
}

model QueryInvalidAddressResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: QueryInvalidAddressResponseBody(name='body'),
}

/**
 * @param request QueryInvalidAddressRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return QueryInvalidAddressResponse
 */
async function queryInvalidAddressWithOptions(request: QueryInvalidAddressRequest, runtime: Util.RuntimeOptions): QueryInvalidAddressResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.endTime)) {
    query['EndTime'] = request.endTime;
  }
  if (!Util.isUnset(request.keyWord)) {
    query['KeyWord'] = request.keyWord;
  }
  if (!Util.isUnset(request.length)) {
    query['Length'] = request.length;
  }
  if (!Util.isUnset(request.nextStart)) {
    query['NextStart'] = request.nextStart;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!Util.isUnset(request.resourceOwnerAccount)) {
    query['ResourceOwnerAccount'] = request.resourceOwnerAccount;
  }
  if (!Util.isUnset(request.resourceOwnerId)) {
    query['ResourceOwnerId'] = request.resourceOwnerId;
  }
  if (!Util.isUnset(request.startTime)) {
    query['StartTime'] = request.startTime;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'QueryInvalidAddress',
    version = '2017-06-22',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @param request QueryInvalidAddressRequest
 * @return QueryInvalidAddressResponse
 */
async function queryInvalidAddress(request: QueryInvalidAddressRequest): QueryInvalidAddressResponse {
  var runtime = new Util.RuntimeOptions{};
  return queryInvalidAddressWithOptions(request, runtime);
}

model QueryMailAddressByParamRequest {
  keyWord?: string(name='KeyWord'),
  ownerId?: long(name='OwnerId'),
  pageNo?: int32(name='PageNo'),
  pageSize?: int32(name='PageSize'),
  resourceOwnerAccount?: string(name='ResourceOwnerAccount'),
  resourceOwnerId?: long(name='ResourceOwnerId'),
  sendtype?: string(name='Sendtype'),
}

model QueryMailAddressByParamResponseBody = {
  pageNumber?: int32(name='PageNumber'),
  pageSize?: int32(name='PageSize'),
  requestId?: string(name='RequestId'),
  totalCount?: int32(name='TotalCount'),
  data?: {
    mailAddress?: [ 
    {
      accountName?: string(name='AccountName'),
      accountStatus?: string(name='AccountStatus'),
      createTime?: string(name='CreateTime'),
      dailyCount?: string(name='DailyCount'),
      dailyReqCount?: string(name='DailyReqCount'),
      domainStatus?: string(name='DomainStatus'),
      mailAddressId?: string(name='MailAddressId'),
      monthCount?: string(name='MonthCount'),
      monthReqCount?: string(name='MonthReqCount'),
      replyAddress?: string(name='ReplyAddress'),
      replyStatus?: string(name='ReplyStatus'),
      sendtype?: string(name='Sendtype'),
    }
  ](name='mailAddress')
  }(name='data'),
}

model QueryMailAddressByParamResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: QueryMailAddressByParamResponseBody(name='body'),
}

/**
 * @param request QueryMailAddressByParamRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return QueryMailAddressByParamResponse
 */
async function queryMailAddressByParamWithOptions(request: QueryMailAddressByParamRequest, runtime: Util.RuntimeOptions): QueryMailAddressByParamResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.keyWord)) {
    query['KeyWord'] = request.keyWord;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!Util.isUnset(request.pageNo)) {
    query['PageNo'] = request.pageNo;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.resourceOwnerAccount)) {
    query['ResourceOwnerAccount'] = request.resourceOwnerAccount;
  }
  if (!Util.isUnset(request.resourceOwnerId)) {
    query['ResourceOwnerId'] = request.resourceOwnerId;
  }
  if (!Util.isUnset(request.sendtype)) {
    query['Sendtype'] = request.sendtype;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'QueryMailAddressByParam',
    version = '2017-06-22',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @param request QueryMailAddressByParamRequest
 * @return QueryMailAddressByParamResponse
 */
async function queryMailAddressByParam(request: QueryMailAddressByParamRequest): QueryMailAddressByParamResponse {
  var runtime = new Util.RuntimeOptions{};
  return queryMailAddressByParamWithOptions(request, runtime);
}

model QueryReceiverByParamRequest {
  keyWord?: string(name='KeyWord'),
  ownerId?: long(name='OwnerId'),
  pageNo?: int32(name='PageNo'),
  pageSize?: int32(name='PageSize'),
  resourceOwnerAccount?: string(name='ResourceOwnerAccount'),
  resourceOwnerId?: long(name='ResourceOwnerId'),
  status?: int32(name='Status'),
}

model QueryReceiverByParamResponseBody = {
  nextStart?: string(name='NextStart'),
  pageSize?: int32(name='PageSize'),
  requestId?: string(name='RequestId'),
  totalCount?: int32(name='TotalCount'),
  data?: {
    receiver?: [ 
    {
      count?: string(name='Count'),
      createTime?: string(name='CreateTime'),
      desc?: string(name='Desc'),
      receiverId?: string(name='ReceiverId'),
      receiversAlias?: string(name='ReceiversAlias'),
      receiversName?: string(name='ReceiversName'),
      receiversStatus?: string(name='ReceiversStatus'),
      utcCreateTime?: long(name='UtcCreateTime'),
    }
  ](name='receiver')
  }(name='data'),
}

model QueryReceiverByParamResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: QueryReceiverByParamResponseBody(name='body'),
}

/**
 * @param request QueryReceiverByParamRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return QueryReceiverByParamResponse
 */
async function queryReceiverByParamWithOptions(request: QueryReceiverByParamRequest, runtime: Util.RuntimeOptions): QueryReceiverByParamResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.keyWord)) {
    query['KeyWord'] = request.keyWord;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!Util.isUnset(request.pageNo)) {
    query['PageNo'] = request.pageNo;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.resourceOwnerAccount)) {
    query['ResourceOwnerAccount'] = request.resourceOwnerAccount;
  }
  if (!Util.isUnset(request.resourceOwnerId)) {
    query['ResourceOwnerId'] = request.resourceOwnerId;
  }
  if (!Util.isUnset(request.status)) {
    query['Status'] = request.status;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'QueryReceiverByParam',
    version = '2017-06-22',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @param request QueryReceiverByParamRequest
 * @return QueryReceiverByParamResponse
 */
async function queryReceiverByParam(request: QueryReceiverByParamRequest): QueryReceiverByParamResponse {
  var runtime = new Util.RuntimeOptions{};
  return queryReceiverByParamWithOptions(request, runtime);
}

model QueryReceiverDetailRequest {
  keyWord?: string(name='KeyWord'),
  nextStart?: string(name='NextStart'),
  ownerId?: long(name='OwnerId'),
  pageSize?: int32(name='PageSize'),
  receiverId?: string(name='ReceiverId', description='This parameter is required.'),
  resourceOwnerAccount?: string(name='ResourceOwnerAccount'),
  resourceOwnerId?: long(name='ResourceOwnerId'),
}

model QueryReceiverDetailResponseBody = {
  dataSchema?: string(name='DataSchema'),
  nextStart?: string(name='NextStart'),
  requestId?: string(name='RequestId'),
  totalCount?: int32(name='TotalCount'),
  data?: {
    detail?: [ 
    {
      createTime?: string(name='CreateTime'),
      data?: string(name='Data'),
      email?: string(name='Email'),
      utcCreateTime?: long(name='UtcCreateTime'),
    }
  ](name='detail')
  }(name='data'),
}

model QueryReceiverDetailResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: QueryReceiverDetailResponseBody(name='body'),
}

/**
 * @param request QueryReceiverDetailRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return QueryReceiverDetailResponse
 */
async function queryReceiverDetailWithOptions(request: QueryReceiverDetailRequest, runtime: Util.RuntimeOptions): QueryReceiverDetailResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.keyWord)) {
    query['KeyWord'] = request.keyWord;
  }
  if (!Util.isUnset(request.nextStart)) {
    query['NextStart'] = request.nextStart;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.receiverId)) {
    query['ReceiverId'] = request.receiverId;
  }
  if (!Util.isUnset(request.resourceOwnerAccount)) {
    query['ResourceOwnerAccount'] = request.resourceOwnerAccount;
  }
  if (!Util.isUnset(request.resourceOwnerId)) {
    query['ResourceOwnerId'] = request.resourceOwnerId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'QueryReceiverDetail',
    version = '2017-06-22',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @param request QueryReceiverDetailRequest
 * @return QueryReceiverDetailResponse
 */
async function queryReceiverDetail(request: QueryReceiverDetailRequest): QueryReceiverDetailResponse {
  var runtime = new Util.RuntimeOptions{};
  return queryReceiverDetailWithOptions(request, runtime);
}

model QueryTagByParamRequest {
  keyWord?: string(name='KeyWord'),
  ownerId?: long(name='OwnerId'),
  pageNo?: int32(name='PageNo'),
  pageSize?: int32(name='PageSize'),
  resourceOwnerAccount?: string(name='ResourceOwnerAccount'),
  resourceOwnerId?: long(name='ResourceOwnerId'),
}

model QueryTagByParamResponseBody = {
  pageNumber?: int32(name='PageNumber', example='5'),
  pageSize?: int32(name='PageSize', example='10'),
  requestId?: string(name='RequestId', example='10A1AD70-E48E-476D-98D9-39BD92193837'),
  totalCount?: int32(name='TotalCount', example='2'),
  data?: {
    tag?: [ 
    {
      tagDescription?: string(name='TagDescription', example='test description'),
      tagId?: string(name='TagId', example='52366'),
      tagName?: string(name='TagName', example='test'),
    }
  ](name='tag')
  }(name='data'),
}

model QueryTagByParamResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: QueryTagByParamResponseBody(name='body'),
}

/**
 * @param request QueryTagByParamRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return QueryTagByParamResponse
 */
async function queryTagByParamWithOptions(request: QueryTagByParamRequest, runtime: Util.RuntimeOptions): QueryTagByParamResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.keyWord)) {
    query['KeyWord'] = request.keyWord;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!Util.isUnset(request.pageNo)) {
    query['PageNo'] = request.pageNo;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.resourceOwnerAccount)) {
    query['ResourceOwnerAccount'] = request.resourceOwnerAccount;
  }
  if (!Util.isUnset(request.resourceOwnerId)) {
    query['ResourceOwnerId'] = request.resourceOwnerId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'QueryTagByParam',
    version = '2017-06-22',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @param request QueryTagByParamRequest
 * @return QueryTagByParamResponse
 */
async function queryTagByParam(request: QueryTagByParamRequest): QueryTagByParamResponse {
  var runtime = new Util.RuntimeOptions{};
  return queryTagByParamWithOptions(request, runtime);
}

model QueryTaskByParamRequest {
  keyWord?: string(name='KeyWord'),
  ownerId?: long(name='OwnerId'),
  pageNo?: int32(name='PageNo'),
  pageSize?: int32(name='PageSize'),
  resourceOwnerAccount?: string(name='ResourceOwnerAccount'),
  resourceOwnerId?: long(name='ResourceOwnerId'),
  status?: int32(name='Status'),
}

model QueryTaskByParamResponseBody = {
  pageNumber?: int32(name='PageNumber'),
  pageSize?: int32(name='PageSize'),
  requestId?: string(name='RequestId'),
  totalCount?: int32(name='TotalCount'),
  data?: {
    task?: [ 
    {
      addressType?: string(name='AddressType'),
      createTime?: string(name='CreateTime'),
      receiversName?: string(name='ReceiversName'),
      requestCount?: string(name='RequestCount'),
      tagName?: string(name='TagName'),
      taskId?: string(name='TaskId'),
      taskStatus?: string(name='TaskStatus'),
      templateName?: string(name='TemplateName'),
      utcCreateTime?: long(name='UtcCreateTime'),
    }
  ](name='task')
  }(name='data'),
}

model QueryTaskByParamResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: QueryTaskByParamResponseBody(name='body'),
}

/**
 * @param request QueryTaskByParamRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return QueryTaskByParamResponse
 */
async function queryTaskByParamWithOptions(request: QueryTaskByParamRequest, runtime: Util.RuntimeOptions): QueryTaskByParamResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.keyWord)) {
    query['KeyWord'] = request.keyWord;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!Util.isUnset(request.pageNo)) {
    query['PageNo'] = request.pageNo;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.resourceOwnerAccount)) {
    query['ResourceOwnerAccount'] = request.resourceOwnerAccount;
  }
  if (!Util.isUnset(request.resourceOwnerId)) {
    query['ResourceOwnerId'] = request.resourceOwnerId;
  }
  if (!Util.isUnset(request.status)) {
    query['Status'] = request.status;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'QueryTaskByParam',
    version = '2017-06-22',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @param request QueryTaskByParamRequest
 * @return QueryTaskByParamResponse
 */
async function queryTaskByParam(request: QueryTaskByParamRequest): QueryTaskByParamResponse {
  var runtime = new Util.RuntimeOptions{};
  return queryTaskByParamWithOptions(request, runtime);
}

model QueryTemplateByParamRequest {
  fromType?: int32(name='FromType'),
  keyWord?: string(name='KeyWord'),
  ownerId?: long(name='OwnerId'),
  pageNo?: int32(name='PageNo'),
  pageSize?: int32(name='PageSize'),
  resourceOwnerAccount?: string(name='ResourceOwnerAccount'),
  resourceOwnerId?: long(name='ResourceOwnerId'),
  status?: int32(name='Status'),
}

model QueryTemplateByParamResponseBody = {
  pageNumber?: int32(name='PageNumber'),
  pageSize?: int32(name='PageSize'),
  requestId?: string(name='RequestId'),
  totalCount?: int32(name='TotalCount'),
  data?: {
    template?: [ 
    {
      createTime?: string(name='CreateTime'),
      smsStatus?: int32(name='SmsStatus'),
      smsTemplateCode?: int32(name='SmsTemplateCode'),
      smsrejectinfo?: int32(name='Smsrejectinfo'),
      templateComment?: string(name='TemplateComment'),
      templateId?: string(name='TemplateId'),
      templateName?: string(name='TemplateName'),
      templateStatus?: string(name='TemplateStatus'),
      templateType?: int32(name='TemplateType'),
      utcCreatetime?: long(name='UtcCreatetime'),
    }
  ](name='template')
  }(name='data'),
}

model QueryTemplateByParamResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: QueryTemplateByParamResponseBody(name='body'),
}

/**
 * @param request QueryTemplateByParamRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return QueryTemplateByParamResponse
 */
async function queryTemplateByParamWithOptions(request: QueryTemplateByParamRequest, runtime: Util.RuntimeOptions): QueryTemplateByParamResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.fromType)) {
    query['FromType'] = request.fromType;
  }
  if (!Util.isUnset(request.keyWord)) {
    query['KeyWord'] = request.keyWord;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!Util.isUnset(request.pageNo)) {
    query['PageNo'] = request.pageNo;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.resourceOwnerAccount)) {
    query['ResourceOwnerAccount'] = request.resourceOwnerAccount;
  }
  if (!Util.isUnset(request.resourceOwnerId)) {
    query['ResourceOwnerId'] = request.resourceOwnerId;
  }
  if (!Util.isUnset(request.status)) {
    query['Status'] = request.status;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'QueryTemplateByParam',
    version = '2017-06-22',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @param request QueryTemplateByParamRequest
 * @return QueryTemplateByParamResponse
 */
async function queryTemplateByParam(request: QueryTemplateByParamRequest): QueryTemplateByParamResponse {
  var runtime = new Util.RuntimeOptions{};
  return queryTemplateByParamWithOptions(request, runtime);
}

model SaveReceiverDetailRequest {
  detail?: string(name='Detail', description='This parameter is required.'),
  ownerId?: long(name='OwnerId'),
  receiverId?: string(name='ReceiverId', description='This parameter is required.'),
  resourceOwnerAccount?: string(name='ResourceOwnerAccount'),
  resourceOwnerId?: long(name='ResourceOwnerId'),
}

model SaveReceiverDetailResponseBody = {
  data?: {
    detail?: [ 
    {
      email?: string(name='Email'),
    }
  ](name='Detail')
  }(name='Data'),
  errorCount?: int32(name='ErrorCount'),
  requestId?: string(name='RequestId'),
  successCount?: int32(name='SuccessCount'),
}

model SaveReceiverDetailResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: SaveReceiverDetailResponseBody(name='body'),
}

/**
 * @param request SaveReceiverDetailRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return SaveReceiverDetailResponse
 */
async function saveReceiverDetailWithOptions(request: SaveReceiverDetailRequest, runtime: Util.RuntimeOptions): SaveReceiverDetailResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.detail)) {
    query['Detail'] = request.detail;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!Util.isUnset(request.receiverId)) {
    query['ReceiverId'] = request.receiverId;
  }
  if (!Util.isUnset(request.resourceOwnerAccount)) {
    query['ResourceOwnerAccount'] = request.resourceOwnerAccount;
  }
  if (!Util.isUnset(request.resourceOwnerId)) {
    query['ResourceOwnerId'] = request.resourceOwnerId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'SaveReceiverDetail',
    version = '2017-06-22',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @param request SaveReceiverDetailRequest
 * @return SaveReceiverDetailResponse
 */
async function saveReceiverDetail(request: SaveReceiverDetailRequest): SaveReceiverDetailResponse {
  var runtime = new Util.RuntimeOptions{};
  return saveReceiverDetailWithOptions(request, runtime);
}

model SenderStatisticsByTagNameAndBatchIDRequest {
  accountName?: string(name='AccountName'),
  endTime?: string(name='EndTime', description='This parameter is required.'),
  ownerId?: long(name='OwnerId'),
  resourceOwnerAccount?: string(name='ResourceOwnerAccount'),
  resourceOwnerId?: long(name='ResourceOwnerId'),
  startTime?: string(name='StartTime', description='This parameter is required.'),
  tagName?: string(name='TagName'),
}

model SenderStatisticsByTagNameAndBatchIDResponseBody = {
  requestId?: string(name='RequestId'),
  totalCount?: int32(name='TotalCount'),
  data?: {
    stat?: [ 
    {
      createTime?: string(name='CreateTime'),
      faildCount?: string(name='faildCount'),
      requestCount?: string(name='requestCount'),
      succeededPercent?: string(name='succeededPercent'),
      successCount?: string(name='successCount'),
      unavailableCount?: string(name='unavailableCount'),
      unavailablePercent?: string(name='unavailablePercent'),
    }
  ](name='stat')
  }(name='data'),
}

model SenderStatisticsByTagNameAndBatchIDResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: SenderStatisticsByTagNameAndBatchIDResponseBody(name='body'),
}

/**
 * @param request SenderStatisticsByTagNameAndBatchIDRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return SenderStatisticsByTagNameAndBatchIDResponse
 */
async function senderStatisticsByTagNameAndBatchIDWithOptions(request: SenderStatisticsByTagNameAndBatchIDRequest, runtime: Util.RuntimeOptions): SenderStatisticsByTagNameAndBatchIDResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.accountName)) {
    query['AccountName'] = request.accountName;
  }
  if (!Util.isUnset(request.endTime)) {
    query['EndTime'] = request.endTime;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!Util.isUnset(request.resourceOwnerAccount)) {
    query['ResourceOwnerAccount'] = request.resourceOwnerAccount;
  }
  if (!Util.isUnset(request.resourceOwnerId)) {
    query['ResourceOwnerId'] = request.resourceOwnerId;
  }
  if (!Util.isUnset(request.startTime)) {
    query['StartTime'] = request.startTime;
  }
  if (!Util.isUnset(request.tagName)) {
    query['TagName'] = request.tagName;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'SenderStatisticsByTagNameAndBatchID',
    version = '2017-06-22',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @param request SenderStatisticsByTagNameAndBatchIDRequest
 * @return SenderStatisticsByTagNameAndBatchIDResponse
 */
async function senderStatisticsByTagNameAndBatchID(request: SenderStatisticsByTagNameAndBatchIDRequest): SenderStatisticsByTagNameAndBatchIDResponse {
  var runtime = new Util.RuntimeOptions{};
  return senderStatisticsByTagNameAndBatchIDWithOptions(request, runtime);
}

model SenderStatisticsDetailByParamRequest {
  accountName?: string(name='AccountName'),
  endTime?: string(name='EndTime'),
  length?: int32(name='Length'),
  nextStart?: string(name='NextStart'),
  ownerId?: long(name='OwnerId'),
  resourceOwnerAccount?: string(name='ResourceOwnerAccount'),
  resourceOwnerId?: long(name='ResourceOwnerId'),
  startTime?: string(name='StartTime'),
  status?: int32(name='Status'),
  tagName?: string(name='TagName'),
  toAddress?: string(name='ToAddress'),
}

model SenderStatisticsDetailByParamResponseBody = {
  nextStart?: int32(name='NextStart'),
  requestId?: string(name='RequestId'),
  data?: {
    mailDetail?: [ 
    {
      accountName?: string(name='AccountName'),
      errorClassification?: string(name='ErrorClassification'),
      lastUpdateTime?: string(name='LastUpdateTime'),
      message?: string(name='Message'),
      status?: int32(name='Status'),
      subject?: string(name='Subject'),
      toAddress?: string(name='ToAddress'),
      utcLastUpdateTime?: string(name='UtcLastUpdateTime'),
    }
  ](name='mailDetail')
  }(name='data'),
}

model SenderStatisticsDetailByParamResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: SenderStatisticsDetailByParamResponseBody(name='body'),
}

/**
 * @param request SenderStatisticsDetailByParamRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return SenderStatisticsDetailByParamResponse
 */
async function senderStatisticsDetailByParamWithOptions(request: SenderStatisticsDetailByParamRequest, runtime: Util.RuntimeOptions): SenderStatisticsDetailByParamResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.accountName)) {
    query['AccountName'] = request.accountName;
  }
  if (!Util.isUnset(request.endTime)) {
    query['EndTime'] = request.endTime;
  }
  if (!Util.isUnset(request.length)) {
    query['Length'] = request.length;
  }
  if (!Util.isUnset(request.nextStart)) {
    query['NextStart'] = request.nextStart;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!Util.isUnset(request.resourceOwnerAccount)) {
    query['ResourceOwnerAccount'] = request.resourceOwnerAccount;
  }
  if (!Util.isUnset(request.resourceOwnerId)) {
    query['ResourceOwnerId'] = request.resourceOwnerId;
  }
  if (!Util.isUnset(request.startTime)) {
    query['StartTime'] = request.startTime;
  }
  if (!Util.isUnset(request.status)) {
    query['Status'] = request.status;
  }
  if (!Util.isUnset(request.tagName)) {
    query['TagName'] = request.tagName;
  }
  if (!Util.isUnset(request.toAddress)) {
    query['ToAddress'] = request.toAddress;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'SenderStatisticsDetailByParam',
    version = '2017-06-22',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @param request SenderStatisticsDetailByParamRequest
 * @return SenderStatisticsDetailByParamResponse
 */
async function senderStatisticsDetailByParam(request: SenderStatisticsDetailByParamRequest): SenderStatisticsDetailByParamResponse {
  var runtime = new Util.RuntimeOptions{};
  return senderStatisticsDetailByParamWithOptions(request, runtime);
}

model SingleSendMailRequest {
  accountName?: string(name='AccountName', description='This parameter is required.'),
  addressType?: int32(name='AddressType', description='This parameter is required.'),
  clickTrace?: string(name='ClickTrace'),
  fromAlias?: string(name='FromAlias'),
  htmlBody?: string(name='HtmlBody'),
  ownerId?: long(name='OwnerId'),
  replyAddress?: string(name='ReplyAddress'),
  replyAddressAlias?: string(name='ReplyAddressAlias'),
  replyToAddress?: boolean(name='ReplyToAddress', description='This parameter is required.'),
  resourceOwnerAccount?: string(name='ResourceOwnerAccount'),
  resourceOwnerId?: long(name='ResourceOwnerId'),
  subject?: string(name='Subject', description='This parameter is required.'),
  tagName?: string(name='TagName'),
  textBody?: string(name='TextBody'),
  toAddress?: string(name='ToAddress', description='This parameter is required.'),
  unSubscribeFilterLevel?: string(name='UnSubscribeFilterLevel'),
  unSubscribeLinkType?: string(name='UnSubscribeLinkType'),
}

model SingleSendMailResponseBody = {
  envId?: string(name='EnvId'),
  requestId?: string(name='RequestId'),
}

model SingleSendMailResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: SingleSendMailResponseBody(name='body'),
}

/**
 * @param request SingleSendMailRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return SingleSendMailResponse
 */
async function singleSendMailWithOptions(request: SingleSendMailRequest, runtime: Util.RuntimeOptions): SingleSendMailResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.accountName)) {
    query['AccountName'] = request.accountName;
  }
  if (!Util.isUnset(request.addressType)) {
    query['AddressType'] = request.addressType;
  }
  if (!Util.isUnset(request.clickTrace)) {
    query['ClickTrace'] = request.clickTrace;
  }
  if (!Util.isUnset(request.fromAlias)) {
    query['FromAlias'] = request.fromAlias;
  }
  if (!Util.isUnset(request.htmlBody)) {
    query['HtmlBody'] = request.htmlBody;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!Util.isUnset(request.replyAddress)) {
    query['ReplyAddress'] = request.replyAddress;
  }
  if (!Util.isUnset(request.replyAddressAlias)) {
    query['ReplyAddressAlias'] = request.replyAddressAlias;
  }
  if (!Util.isUnset(request.replyToAddress)) {
    query['ReplyToAddress'] = request.replyToAddress;
  }
  if (!Util.isUnset(request.resourceOwnerAccount)) {
    query['ResourceOwnerAccount'] = request.resourceOwnerAccount;
  }
  if (!Util.isUnset(request.resourceOwnerId)) {
    query['ResourceOwnerId'] = request.resourceOwnerId;
  }
  if (!Util.isUnset(request.subject)) {
    query['Subject'] = request.subject;
  }
  if (!Util.isUnset(request.tagName)) {
    query['TagName'] = request.tagName;
  }
  if (!Util.isUnset(request.textBody)) {
    query['TextBody'] = request.textBody;
  }
  if (!Util.isUnset(request.toAddress)) {
    query['ToAddress'] = request.toAddress;
  }
  if (!Util.isUnset(request.unSubscribeFilterLevel)) {
    query['UnSubscribeFilterLevel'] = request.unSubscribeFilterLevel;
  }
  if (!Util.isUnset(request.unSubscribeLinkType)) {
    query['UnSubscribeLinkType'] = request.unSubscribeLinkType;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'SingleSendMail',
    version = '2017-06-22',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @param request SingleSendMailRequest
 * @return SingleSendMailResponse
 */
async function singleSendMail(request: SingleSendMailRequest): SingleSendMailResponse {
  var runtime = new Util.RuntimeOptions{};
  return singleSendMailWithOptions(request, runtime);
}

model SingleSendMailV2Request {
  accountName?: string(name='AccountName', description='This parameter is required.', example='test***@example.net'),
  addressType?: int32(name='AddressType', description='This parameter is required.', example='1'),
  clickTrace?: string(name='ClickTrace', example='0'),
  fromAlias?: string(name='FromAlias'),
  htmlBody?: string(name='HtmlBody', example='body'),
  htmlBodyPlaceHolders?: [ 
    {
      placeHolders?: map[string]string(name='PlaceHolders'),
      toAddress?: string(name='ToAddress', example='test1***@example.net'),
    }
  ](name='HtmlBodyPlaceHolders'),
  ownerId?: long(name='OwnerId'),
  replyAddress?: string(name='ReplyAddress', example='test2***@example.net'),
  replyAddressAlias?: string(name='ReplyAddressAlias'),
  replyToAddress?: boolean(name='ReplyToAddress', description='This parameter is required.', example='true'),
  resourceOwnerAccount?: string(name='ResourceOwnerAccount'),
  resourceOwnerId?: long(name='ResourceOwnerId'),
  subject?: string(name='Subject', description='This parameter is required.', example='Subject'),
  tagName?: string(name='TagName', example='test'),
  textBody?: string(name='TextBody', example='body'),
  toAddress?: string(name='ToAddress', description='This parameter is required.', example='test1***@example.net'),
}

model SingleSendMailV2ShrinkRequest {
  accountName?: string(name='AccountName', description='This parameter is required.', example='test***@example.net'),
  addressType?: int32(name='AddressType', description='This parameter is required.', example='1'),
  clickTrace?: string(name='ClickTrace', example='0'),
  fromAlias?: string(name='FromAlias'),
  htmlBody?: string(name='HtmlBody', example='body'),
  htmlBodyPlaceHoldersShrink?: string(name='HtmlBodyPlaceHolders'),
  ownerId?: long(name='OwnerId'),
  replyAddress?: string(name='ReplyAddress', example='test2***@example.net'),
  replyAddressAlias?: string(name='ReplyAddressAlias'),
  replyToAddress?: boolean(name='ReplyToAddress', description='This parameter is required.', example='true'),
  resourceOwnerAccount?: string(name='ResourceOwnerAccount'),
  resourceOwnerId?: long(name='ResourceOwnerId'),
  subject?: string(name='Subject', description='This parameter is required.', example='Subject'),
  tagName?: string(name='TagName', example='test'),
  textBody?: string(name='TextBody', example='body'),
  toAddress?: string(name='ToAddress', description='This parameter is required.', example='test1***@example.net'),
}

model SingleSendMailV2ResponseBody = {
  envId?: string(name='EnvId', example='xxxxxx'),
  requestId?: string(name='RequestId', example='2D086F6-8F31-4658-84C1-006DED011A85'),
}

model SingleSendMailV2Response = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: SingleSendMailV2ResponseBody(name='body'),
}

/**
 * @summary 极高发信专用API
 *
 * @param tmpReq SingleSendMailV2Request
 * @param runtime runtime options for this request RuntimeOptions
 * @return SingleSendMailV2Response
 */
async function singleSendMailV2WithOptions(tmpReq: SingleSendMailV2Request, runtime: Util.RuntimeOptions): SingleSendMailV2Response {
  Util.validateModel(tmpReq);
  var request = new SingleSendMailV2ShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!Util.isUnset(tmpReq.htmlBodyPlaceHolders)) {
    request.htmlBodyPlaceHoldersShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.htmlBodyPlaceHolders, 'HtmlBodyPlaceHolders', 'json');
  }
  var query = {};
  if (!Util.isUnset(request.accountName)) {
    query['AccountName'] = request.accountName;
  }
  if (!Util.isUnset(request.addressType)) {
    query['AddressType'] = request.addressType;
  }
  if (!Util.isUnset(request.clickTrace)) {
    query['ClickTrace'] = request.clickTrace;
  }
  if (!Util.isUnset(request.fromAlias)) {
    query['FromAlias'] = request.fromAlias;
  }
  if (!Util.isUnset(request.htmlBody)) {
    query['HtmlBody'] = request.htmlBody;
  }
  if (!Util.isUnset(request.htmlBodyPlaceHoldersShrink)) {
    query['HtmlBodyPlaceHolders'] = request.htmlBodyPlaceHoldersShrink;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!Util.isUnset(request.replyAddress)) {
    query['ReplyAddress'] = request.replyAddress;
  }
  if (!Util.isUnset(request.replyAddressAlias)) {
    query['ReplyAddressAlias'] = request.replyAddressAlias;
  }
  if (!Util.isUnset(request.replyToAddress)) {
    query['ReplyToAddress'] = request.replyToAddress;
  }
  if (!Util.isUnset(request.resourceOwnerAccount)) {
    query['ResourceOwnerAccount'] = request.resourceOwnerAccount;
  }
  if (!Util.isUnset(request.resourceOwnerId)) {
    query['ResourceOwnerId'] = request.resourceOwnerId;
  }
  if (!Util.isUnset(request.subject)) {
    query['Subject'] = request.subject;
  }
  if (!Util.isUnset(request.tagName)) {
    query['TagName'] = request.tagName;
  }
  if (!Util.isUnset(request.textBody)) {
    query['TextBody'] = request.textBody;
  }
  if (!Util.isUnset(request.toAddress)) {
    query['ToAddress'] = request.toAddress;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'SingleSendMailV2',
    version = '2017-06-22',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 极高发信专用API
 *
 * @param request SingleSendMailV2Request
 * @return SingleSendMailV2Response
 */
async function singleSendMailV2(request: SingleSendMailV2Request): SingleSendMailV2Response {
  var runtime = new Util.RuntimeOptions{};
  return singleSendMailV2WithOptions(request, runtime);
}

